﻿<dx:DXWindow x:Class="Cinser.Common.Silverlight.Controls.VedioPlayer" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           d:DesignWidth="740" d:DesignHeight="550"
           xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:dxco="http://schemas.devexpress.com/winfx/2008/xaml/controls" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:a="http://schemas.devexpress.com/winfx/2008/xtr"
           Title="图片浏览">
    <Grid x:Name="LayoutRoot" ShowGridLines="False"  >
        <!--Grid布局：分成三行，第一行放视频窗口，第二行为进度条，第三行为其它控制按钮-->
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="22"></RowDefinition>
            <RowDefinition Height="25"></RowDefinition>
        </Grid.RowDefinitions>

        <!--视频播放控件-->
        <MediaElement x:Name="media" Source="" Grid.Row="0"  Grid.Column="0" CurrentStateChanged="Media_State_Changed" MediaEnded="media_MediaEnded" Cursor="Hand" MouseLeftButtonDown="media_MouseLeftButtonDown" BufferingProgressChanged="media_BufferingProgressChanged" DownloadProgressChanged="media_DownloadProgressChanged"></MediaElement>
        <!--这里用一个Canvas来实现暂停时的遮盖效果-->
        <Canvas Background="#AAFAEBD7"  Grid.Row="0" Grid.Column="0"  Cursor="Hand"  x:Name="canvas_Pause" MouseLeftButtonDown="Canvas_MouseLeftButtonDown" >
            <Ellipse Height="200" Width="200" Stroke="AliceBlue" StrokeThickness="10" Canvas.Left="140" Canvas.Top="80"></Ellipse>
            <Path Stretch="Fill" Stroke="AliceBlue" StrokeThickness="10" Height="98" Width="10" UseLayoutRounding="False" Canvas.Left="203" Canvas.Top="131" Data="M208,136 L208,224"/>
            <Path Stretch="Fill" Stroke="AliceBlue" StrokeThickness="10" Height="98" Width="10" UseLayoutRounding="False" Canvas.Left="263" Canvas.Top="131" Data="M208,136 L208,224"/>
            <TextBlock Canvas.Left="104" Canvas.Top="296" Foreground="White" >Made by 菩提树下的杨过(http://yjmyzz.cnblogs.com/)</TextBlock>
        </Canvas>

        <MediaElement x:Name="mediaBuffer" Width="0" Grid.Column="0" Grid.Row="0" BufferingTime="0:0:10" IsMuted="True" AutoPlay="True"  ></MediaElement>
        <!--第二行用一个StackPanel横向放了二个子控件，用于显示进度条和当前播放时间-->
        <StackPanel Grid.Column="0" Grid.Row="1" Orientation="Horizontal"  HorizontalAlignment="Center" >
            <Slider Height="20" Width="370" x:Name="sliderProgress" ValueChanged="sliderProgress_ValueChanged" Cursor="Hand" ></Slider>
            <TextBlock Text="00:00:00/00:00:00" Width="110" x:Name="txtTime"/>
        </StackPanel>
        <!--第三行同样用StackPanel横向放置其它控制按钮-->
        <StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" >
            <Button Click="PlayMedia"  Content="||" Width="25" Height="25" x:Name="btnPlay" Cursor="Hand" />
            <Button Click="StopMedia"  Content="■" Width="25" Height="25" x:Name="btnStop" Cursor="Hand"/>
            <TextBlock x:Name="txtProgress"   FontSize="12" Width="90" Text="缓冲中100%" Height="25" TextAlignment="Center" Margin="3,0"  Padding="0,6,0,0"  ></TextBlock>
            <ComboBox x:Name="cboList" SelectionChanged="cboList_SelectionChanged" Height="25" Width="232">

            </ComboBox>
            <Button Content="静" Width="25" Height="25" Margin="3,0" x:Name="btnVoice" Click="btnVoice_Click" Cursor="Hand"></Button>
            <Slider Height="25" Width="50" x:Name="sliderVoice" Maximum="1" Minimum="0" ValueChanged="sliderVoice_ValueChanged" Value="0.5" Cursor="Hand" ></Slider>
            <Button Content="全" Width="20" Height="25" Cursor="Hand" x:Name="btnFull" Click="btnFull_Click"></Button>
        </StackPanel>
    </Grid>
</dx:DXWindow>
